<template>
  <a-tag :color="color">{{ $getEnum(authDict, this.flag) }}</a-tag>
</template>

<script>
import authDict from "@/dict/auth";

export default {
  props: {
    flag: {
      type: Number
    }
  },
  data() {
    return {
      authDict
    };
  },
  computed: {
    color() {
      let res;
      let colors = {
        green: [authDict.person.value, authDict.finish.value],
        orange: [
          authDict.backfill.value,
          authDict.auditing.value,
          authDict.examining.value
        ],
        red: [authDict.failed.value]
      };
      // 查找当前订单状态对应的颜色
      for (const key in colors) {
        if (colors[key].indexOf(this.flag) !== -1) {
          res = key;
        }
      }
      return res;
    }
  }
};
</script>
